package org.rcgwt.client.ui.themes;

import org.rcgwt.client.theme.CssStyle;

public class DateChooserTheme implements IDateChooserTheme {

	private static final String _DATECHOOSER_MAIN_STYLE_CLASS = "dateChooser";
	private static final String _DATECHOOSER_RICHCALENDAR_STYLE_CLASS = "richCalendar";
	private static final String _DATECHOOSER_POPUP_PANEL_STYLE_CLASS = "popupPanel";
	private static final String _DATECHOOSER_DATE_BUTTON_STYLE_CLASS = "dateButton";

	private static final String _DATECHOOSER_DISABLED_SUFFIX = "disabled";

	private static CssStyle DATECHOOSER_MAIN_STYLE;
	private static CssStyle DATECHOOSER_RICHCALENDAR_STYLE;
	private static CssStyle DATECHOOSER_POPUP_PANEL_STYLE;
	private static CssStyle DATECHOOSER_DATE_BUTTON_STYLE;

	@Override
	public CssStyle getDateChooserStyle() {
		if (DATECHOOSER_MAIN_STYLE == null) {
			DATECHOOSER_MAIN_STYLE = CssStyle
					.create(_DATECHOOSER_MAIN_STYLE_CLASS);
		}
		return DATECHOOSER_MAIN_STYLE;
	}

	@Override
	public CssStyle getRichCalendarStyle() {
		if (DATECHOOSER_RICHCALENDAR_STYLE == null) {
			DATECHOOSER_RICHCALENDAR_STYLE = CssStyle
					.create(_DATECHOOSER_RICHCALENDAR_STYLE_CLASS);
		}
		return DATECHOOSER_RICHCALENDAR_STYLE;
	}

	@Override
	public CssStyle getPopupPanelStyle() {
		if (DATECHOOSER_POPUP_PANEL_STYLE == null) {
			DATECHOOSER_POPUP_PANEL_STYLE = CssStyle
					.create(_DATECHOOSER_POPUP_PANEL_STYLE_CLASS);
		}
		return DATECHOOSER_POPUP_PANEL_STYLE;
	}

	@Override
	public CssStyle getDateButtonStyle() {
		if (DATECHOOSER_DATE_BUTTON_STYLE == null) {
			DATECHOOSER_DATE_BUTTON_STYLE = CssStyle
					.create(_DATECHOOSER_DATE_BUTTON_STYLE_CLASS);
		}
		return DATECHOOSER_DATE_BUTTON_STYLE;
	}

	@Override
	public CssStyle getDisabledDateButtonStyle() {
		return getDateButtonStyle().addSuffix(_DATECHOOSER_DISABLED_SUFFIX);
	}
}
